package exception.demo1;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FinallyDemo2 {
    public static void main(String[] args) {
        System.out.println("程序开始");
        FileOutputStream fos=null;
        try{
            fos=new FileOutputStream("./a/b/c/fos.txt");
        } catch (FileNotFoundException e) {
            System.out.println("发现了一个异常并已解决");
        }finally {
            try {
                fos.close();
            } catch (IOException e) {
                System.out.println("关闭流时发现了一个异常并已解决");
            }
        }
        System.out.println("程序结束");
    }
}
